package de.baumann.browser.views.dialog

import android.content.Context
import android.view.Gravity
import android.widget.Toast
import de.baumann.browser.R
import kotlinx.android.synthetic.main.dialog_transfer_pwd.*

class PayPwdDialog(context: Context, var callback: PwdCallback) : BaseDialog(context) {
    override fun laoutId(): Int {
        return R.layout.dialog_transfer_pwd
    }

    override fun gravity(): Int {
        return Gravity.BOTTOM
    }

    override fun initView() {
        tvTPC.setOnClickListener {
            dismiss()
        }

        tvTPO.setOnClickListener {
            if (getPwd().isEmpty()) {
                Toast.makeText(mContext, "请输入密码", Toast.LENGTH_SHORT).show()
                return@setOnClickListener
            }
//            dismiss()
            callback.callback(getPwd())
        }
    }

    private fun getPwd(): String {
        return edTPWD.text.toString().trim()
    }

    interface PwdCallback {
        fun callback(pwd: String)
    }


}